package com.joven.product.service.business.domain.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 商品状态
 *
 * @author Joven
 * @date 2022/6/25 17:00
 */
@AllArgsConstructor
@Getter
public enum ProductStatusEnum {
    TO_SALE(0, "待售"), ON_SALE(1, "在售"), OFF_SHELF(2, "下架");
    private Integer code;
    private String desc;

    public static ProductStatusEnum getByCode(Integer code) {
        for (ProductStatusEnum statusEnum : values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }
}
